/*
 * Copyright (c) 2018, apexes.net. All rights reserved.
 *
 *         http://www.apexes.net
 *
 */
package io.vertx.core.eventbus.impl.clustered;

import io.vertx.core.net.impl.ServerID;
import net.apexes.vertx.ClusteredMessageLogger;

/**
 * @author <a href=mailto:hedyn@foxmail.com>HeDYn</a>
 */
class LoggerConnectionHolder extends ConnectionHolder {

    private final ServerID serverID;
    private final ClusteredMessageLogger logger;

    LoggerConnectionHolder(ClusteredEventBus eventBus, ServerID serverID, ClusteredMessageLogger logger) {
        super(eventBus, serverID, eventBus.options());
        this.serverID = serverID;
        this.logger = logger;
    }

    @Override
    void writeMessage(ClusteredMessage message) {
        logger.logSend(serverID, message);
        super.writeMessage(message);
    }
}
